<?php
namespace app\index\controller;

use app\common\controller\Base;

class Api extends Base
{
    //注册行为
	protected $reg = '';
    //登录行为
    protected $login = '';
    //验证码行为行为
    protected $captcha = '';

    //类名
    protected $className = '';

	protected $beforeActionList = [
        'dataVer' =>  ['except'=>'reg'],
        'interfaceAction'
    ];
    //注册接口
    public function reg()
    {
        $className = $this -> reg;
    }
    //登录接口
    public function login()
    {
        $className = $this -> login;
    }
    //验证码接口
    public function captcha()
    {
        $className = $this -> captcha;  
    }
    //参数认证
    protected function dataVer()
    {
        
    }
    //接口行为绑定
    protected function interfaceAction()
    {
        $this -> reg = 'DefaultRegistration';
    }
    //析构函数
    public function __destruct(){
        $className = $this -> className;
        if(!empty($className)){
            $classDir = "$className\\$className";
            $class = new $classDir();
            $class -> run();
        }
    }
}
